<?php
print $html->docType('html4-trans');
?>

<html xmlns="http://www.w3.org/1999/xhtml" lang="hu" xml:lang="hu">
<head>
<?php print $html->charset('utf-8');

if(isset($metaDescription))
	print $html->meta('description',$metaDescription);
?>
<title><?php print $title_for_layout ?></title>
<?php
	print $html->meta('favicon.ico', 'favicon.ico', array('type' => 'icon'));
	print $html->css('sociall', 'stylesheet', array('media'=>'screen'));
	print $javascript->link('prototype');
	print $javascript->link('scriptaculous');
	print $javascript->link('notify');
	print $javascript->link('sociall');
	print $scripts_for_layout;
?>
</head>
<body>
<div id="page">
	<div id="header">
		<h1><?php print $html->link(__('SociALL', true), '/'); ?></h1>
		<?php
		print $html->link(
						$html->image(
									'logo.jpg',
									array(
										'id' => 'logo',
										'alt'=>'SociALL logo'
										)
									),
						'/',
						array(
							'title' => 'SociALL ' . __('Home', true)
							),
						null, false);
		
			print '<ul id="languages" class="nolisg">';
				print '<li>' . $html->link('EN', array('language' => 'en'), array('title' => 'Select language')) . '</li>';
				print '<li>' . $html->link('HU', array('language' => 'hu'), array('title' => 'Válassz nyelvet')) . '</li>';
				//print '<li id="exit">' . $html->link('x', array('controller' => 'users', 'action'=>'logout', 'admin'=>false, 'title' => __('Logout', true))) . '</li>';
			print '</ul>';
		?>
	</div>
	<?php
	//debug($this);
		$cssClass = '';
		$mainPages = array(
							'users/login',
							'users/register',
							'pages/why',
							'pages/how'
							);
		//print str_replace(Configure::read('Config.language') . '/', '', $this->params['url']['url']);
		if(in_array(str_replace(Configure::read('Config.language') . '/', '', $this->params['url']['url']), $mainPages))
			$cssClass = 'main';
	?>
	<div id="content" class="cbg_<?php print $cssClass; ?>">
			<?php
			if($session->read('Auth.User')){
				print '<ul id="menu" class="nolisg fr">';
				if($session->read('Auth.User.id')){
					print '<li ' . ((in_array($this->params['url']['url'], array('/', Configure::read('Config.language').'/messages/index'))) ? 'class="act"' : '') . '>' . $html->link(__('Messages', true),
																																						array(
																																							'controller' => 'messages',
																																							'action'=>'index',
																																							'admin'=>false
																																							),
																																						null, null, false) .
																																	' <span id="cB" title="'.__('Get messages now', true).'"></span>' .
																																	$html->image('ajax-loader.gif',
																																				  array(
																																						'id' => 'ajaxloaderMenu',
																																						'style' => 'display: none',
																																						'alt' => __('Ajax loading indicator', true),
																																						'title' => __('Getting new messages', true)
																																						 )
																																				  ) .
																																	'</li>';
					print '<li ' . (($this->params['url']['url'] == 'users/edit') ? 'class="act"' : '') . '>' . $html->link(__('Profile', true), array('controller' => 'users', 'action'=>'edit', 'admin'=>false)) . '</li>';
					print '<li>' . $html->link(__('Logout', true), array('controller' => 'users', 'action'=>'logout', 'admin'=>false)) . '</li>';
					//print '<li>' . $html->link(__('Timed', true), array('controller' => 'messages', 'action'=>'timed', 'admin'=>false)) . '</li>';
				}
				print '<li class="important">' . $html->link(__('Contribute', true), array('controller' => 'pages', 'action'=>'display', 'contribute', 'admin'=>false)) . '</li>';
				print '</ul>';
			}
			?>

		<div>
			<?php
			if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6'))
				print '<h2>' . __('You are using a really old browser. <a href="http://firefox.com">Please update</a>.', true) . '</h2>';
			else
				print $content_for_layout;
			?>
		</div>
	</div>

	<div id="footer">
		<ul>
			<li><?php print $html->link(__('Blog', true), 'http://sociall.cc/blog/');?></li>
			<li><?php print $html->link(__('Terms of use', true), array('controller' => 'pages', 'action'=>'display', 'termsofuse'));?></li>
			<li><?php print $html->link(__('Privacy policy', true), array('controller' => 'pages', 'action'=>'display', 'privacypolicy'));?></li>
			<li><?php print $html->link(__('Impressum', true), array('controller' => 'pages', 'action'=>'display', 'impressum'));?></li>
		</ul>
	 
	</div>
</div>
<div id="notify" style="display: none;">
	<span id="notifyClose">x</span>
	<span id="notification"><?php
	if($session->check('Message.flash')) {
		$session->flash();
	}
	$hide_error = array('login', 'display', 'register', 'activate_account');
	if($session->check('Message.auth')){
		if(!in_array($session->action, $hide_error) || $session->data)	//az alap nyitólapra való átirányításnál nem kell az authError-t megjeleníteni
			$session->flash('auth');
		else
			$session->del('Message.auth');
	}
	if(isset($errorz)){
		foreach($errorz as $error){
			$this->log(print_r($error, true), LOG_DEBUG);
			print $error['data']['message'];
			print ' (' . $error['data']['account']['Account']['username'] . ')';
			print '<br />';
		}
	}
	
	?></span>
</div>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-2231644-28");
pageTracker._trackPageview();
} catch(err) {}</script>
</body>
</html>